package ac.java.windows;

import java.util.Scanner;

public class AcWinProcess {
	public static boolean kill(String processName)
	{
		Process process = null;
		int pid = 0;
		try {
			System.out.print("abc");
			process = Runtime.getRuntime().exec("tasklist");
			Scanner in = new Scanner(process.getInputStream());
			while (in.hasNextLine()) {
				String p = in.nextLine();
				System.out.println(p);
				
				pid = Integer.parseInt(p.split("Console")[0]);
				Runtime.getRuntime().exec("tskill" + " " + pid);
			}
		} catch (Exception e) {
			System.out.print("bce");
			// TODO: handle exception
		}
		
		return true;
	}
	
	public static void main(String[] args) {
		AcWinProcess.kill("WINWORD.EXE");
	}
}
